home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_exmh.idb / usr / freeware / lib / exmh-2.5 / extrasInit.tcl.z / extrasInit.tcl
Text File  |  2002-07-08  |  39KB  |  930 lines

  1. # extrasInit.tcl
  2. #
  3. # This has initialization code for some extra packages.
  4. # The idea is to avoid auto_loading the whole package,
  5. # while still allowing the package to manifest itself
  6. # in the preferences dialog (for example).
  7. #
  8. # Copyright (c) 1993 Xerox Corporation.
  9. # Use and copying of this software and preparation of derivative works based
  10. # upon this software are permitted. Any distribution of this software or
  11. # derivative works must comply with all applicable United States export
  12. # control laws. This software is made available AS IS, and Xerox Corporation
  13. # makes no warranty about the software, its performance or its conformity to
  14. # any specification.
  15.  
  16. proc TopTenPreferences {} {
  17.     Preferences_Add "The Top Ten" \
  18. "Exmh has too many preferences.  Some of the more important ones are
  19. collected here.  The preferences panel they come from is identified
  20. in the extended help information for each item." {
  21.  
  22.     { exmh(background) bgAction {CHOICE off count msgchk flist inc hook} {Background processing}
  23. "exmh can periodically do some things for you:
  24. count - count new messages sitting in your spool file.
  25. msgchk - run the MH msgchk program.
  26. flist - check for new mail in all folders.
  27. inc - just like clicking the Inc button yourself.
  28. hook - suppply your own Hook_Background procedure.
  29. off - do nothing in the background.
  30. (Background Processing Preferences.)"}
  31.  
  32.     {inc(style) incStyle    {CHOICE inbox presort multidrop presortmulti custom none} {Ways to Inc}
  33. "inbox - basic MH inc from your spool file to inbox folder.
  34. presort - slocal filtering directly into various folders.
  35. multidrop - slocal filtering or POP delivery into various drop boxes,
  36. as specified by ~/.xmhcheck, that are in turn inc'ed into folders.
  37. presortmulti - presort + multidrop.
  38. custom - use an Inc_Custom procedure, which is user supplied.
  39. none - you have an external agent that handles inc for you, so
  40. don't bother trying it from within exmh.
  41. (Incorporate Mail Preferences.)"}
  42.  
  43.     {inc(pophost) popHost {}      {Mail host for POP3 protocol}
  44. "If this is set, inc will try to use the POP3 protocol to
  45. fetch your mail from a mail server."}
  46.  
  47.     {editor(prog) editCmd sedit {Editor command}
  48. "The editor command used to compose mail messages.
  49. The filename will be appended to the command.
  50. \"sedit\" is the built-in editor.
  51. Example commands include:
  52. sedit
  53. emacsclient &
  54. give-away emacsclient
  55. gnuclient &
  56. give-away gnuclient
  57. exmh-async emacs
  58. exmh-async emacsclient
  59. exmh-async xterm -e vi
  60. (Editor Support Preferences.)"}
  61.  
  62.     {ftoc(autoCommit) autoCommit OFF "Auto Commit"
  63. "If set, Exmh will invoke the Commit operation to
  64. commit deletions and refiles when it would otherwise
  65. just complain that such a commit is required.
  66. (Scan Listing Preferences.)"}
  67.  
  68.     {uri(scanForURIs) uriScanForURIs    OFF {Scan for URLs in messages}
  69. "This tells exmh to automatically scan for URLs in messages.
  70. If you turn it on, any URLs it finds will be turned into buttons
  71. which you can click on to launch a viewer application.
  72. This can slow down message displaying somewhat, 
  73. so you may prefer to do this manually by typing <Key-z>
  74. (WWW Preferences.)"}
  75.  
  76.     { unseenwin(on) unseenWinOn OFF {Enable Unseen Window}
  77. "Enables the window that summarizes your unseen messages.
  78. (Unseen Window Preferences.)" }
  79.  
  80.     { sound(enabled) soundEnabled ON {Sound feedback}
  81. "Enable audio feedback.  Exmh will make a sound when
  82. new messages are incorporated into your folders
  83. (except during startup) and when you try to change
  84. folders without committing moves and delete operations.
  85. (Sound Preferences.)"} 
  86.  
  87.     {faces(enabled) facesEnabled ON {Use faces database}
  88. "Search for and display images from the facesaver database.
  89. (Faces Preferences.)"}
  90.     {
  91.             addr_db(enabled)
  92.             addressdbEnabled
  93.             ON
  94.             "Automatic address saving"
  95.             "If set, From addresses are remembered and available in an address browser."
  96.     }
  97.  
  98.     }
  99. }
  100.  
  101. proc SlowDisplay_Init {} {
  102.     global exmh
  103.  
  104.     Preferences_Add "Slow Display" \
  105. "These items determine which parts of the system to disable when you have a 
  106. slow display" {
  107.         {exmh(slowDispLimit) slowDispLimit 200000    {Slow Display Limit}
  108. "Exmh will time how long takes to create and destroy a test icon.
  109. If it takes more microseconds than the number specified here,
  110. exmh will consider itself to be on a \"slow display\"."}
  111.         {exmh(slowDispFaces) slowDispFaces {CHOICE {when fast} always never} {Show Faces}
  112. "Based on whether exmh could manipulate color icons in times faster
  113. than the Slow Display Limit, exmh can decide whether to show any
  114. Faces icons which happen to be associated with the current message.
  115. Selecting \"when fast\" lets exmh use its own judgment about the
  116. message icons; selecting \"always\" or \"never\" force exmh to
  117. behave the way you specify."}
  118.         {exmh(slowDispIcons) slowDispIcons {CHOICE {when fast} always never} {Show color icons}
  119. "Based on whether exmh could manipulate color icons in times faster
  120. than the Slow Display Limit, exmh can decide whether to display a
  121. color icon when its main window is iconified.  Selecting \"when fast\"
  122. lets exmh use its own judgment about its main icon; selecting
  123. \"always\" or \"never\" force exmh to behave the way you specify.
  124.  
  125. If you try to use the color icon but find that you have trouble
  126. clicking on an iconified exmh to de-iconify it, you should set
  127. this value to \"never\"."}
  128.     }
  129.  
  130.     # Change users' slowDispFaces,slowDispIcons, from ON/OFF to CHOICE:
  131.     switch $exmh(slowDispFaces) {
  132.     1 {set exmh(slowDispFaces) always}
  133.     0 {set exmh(slowDispFaces) {when fast}}
  134.     }
  135.     switch $exmh(slowDispIcons) {
  136.     1 {set exmh(slowDispIcons) always}
  137.     0 {set exmh(slowDispIcons) {when fast}}
  138.     }
  139.  
  140.     Preferences_Resource exmh(testglyph) testGlyph flagdown.gif
  141.     if ![string match /* exmh(testglyph)] {
  142.     set exmh(testglyph) $exmh(library)/$exmh(testglyph)
  143.     }
  144.     set time [lindex [time {
  145.     toplevel .foo
  146.     pack [canvas .foo.c]
  147.     image create photo testicon -file $exmh(testglyph)
  148.     .foo.c configure -width [image width testicon] \
  149.         -height [image height testicon]
  150.     destroy .foo
  151.     }] 0]
  152.     set exmh(slowDisp) [expr {$time > $exmh(slowDispLimit)}]
  153.     if $exmh(slowDisp) {
  154.     Exmh_Debug "Slow display: took $time microseconds to create test icon"
  155.     set exmh(slowDispShowFaces) [string match $exmh(slowDispFaces) {always}]
  156.     set exmh(slowDispColorIcon) [string match $exmh(slowDispIcons) {always}]
  157.     } else {
  158.     Exmh_Debug "Fast display: took $time microseconds to create test icon"
  159.     set exmh(slowDispShowFaces) [expr { ![string match $exmh(slowDispFaces) {never}] }]
  160.     set exmh(slowDispColorIcon) [expr { ![string match $exmh(slowDispIcons) {never}] }]
  161.     }
  162. }
  163.  
  164. proc Faces_Init {} {
  165.     global faces
  166.     if {$faces(dir) == {}} {
  167.     set faces(enabled) 0
  168.     }
  169.     # faces(suffix) starts out (by default) with {xpm gif xbm}
  170.     if {![info exists faces(suffix)] || ([llength $faces(suffix)] == 0)} {
  171.     set faces(suffix) xbm
  172.     }
  173.     # Double check the non-standard pixmap image type to avoid file stat
  174.     if {[lsearch [image types] pixmap] < 0} {
  175.     set ix [lsearch $faces(suffix) xpm]
  176.     if {$ix >= 0} {
  177.         set faces(suffix) [lreplace $faces(suffix) $ix $ix]
  178.     }
  179.     }
  180.  
  181.     Preferences_Add "Faces" \
  182. "Exmh will display a bitmap or image of the person that sent the current message (or their organization).  This relies on the faces/picon database, or the presence of an X-Face: mail header.
  183.  
  184. Any given mail address can match a range of face images, from most specific (such as an X-Face) or most general (such as an a default image for a toplevel domain)." {
  185.  
  186.         {faces(xFaceEnabled) xFaceEnabled ON {Use X-Face headers}
  187.     "If a message contains an X-Face header, display the image encoded into the header."}
  188.  
  189.     {faces(xfaceProg) xfaceProg {} {X-Face command}
  190. "A command to convert an X-Face: header line into a displayable X11 bitmap.
  191.  
  192. If you've patch uncompface, this can be:    uncompface -X
  193. otherwise you should use this:            uncompface | ikon2xbm
  194.  
  195. Defining this enables the display of X-Face images.  This is independent of the facesaver database."}
  196.  
  197.     {faces(enabled) facesEnabled ON {Use faces database}
  198. "Search for and display images from the facesaver database."}
  199.  
  200.     {faces(rowEnabled) facesRow OFF {Use faces row}
  201. "Use a horizontal row to display all the matching images of a face, rather than the most specific one."}
  202.  
  203.         {faces(xImageUrl) xImageUrl ON {Use X-Image-URL}
  204. "If a message contains an X-Image-URL header, display the image referenced in that header."}
  205.  
  206.     {faces(defer) facesDefer ON {Background processing} 
  207. "When on, this causes faces display to be handled as a background task.  This allows the display of a faces row to be aborted when another message is selected.  If your machine can display faces quickly enough, you should turn this off."}
  208.  
  209.     {faces(palette) facesPalette {} {Size of color palette}
  210. "This allows you to force exmh to render face images in a less color-consuming
  211. manner.  Valid settings are as for the -palatte option of the Image Photo widget.
  212.  
  213. With the default setting, an empty string, images are rendered in as large a color cube as the photo widget can allocate.
  214.  
  215. When set to a single decimal number, this specifies the number of shades of gray to use.  A value of 2 results in a dithered monochrome; 32 results in a pleasing greyscale.
  216.  
  217. When set to three decimal numbers separated by slashes (/), specifying the number of shades of red, green and blue to use, respectively.  5/5/4 is a useful setting for an 8-bit Pseudocolor display"}
  218.  
  219.      }
  220. }
  221.  
  222. proc Faces_Create { parent } {
  223.     global faces
  224.  
  225.     # Remember these
  226.     set faces(parent) $parent
  227.     set faces(rowparent) [winfo parent $parent]
  228.  
  229.     trace variable faces(rowEnabled) w Faces_Setup
  230.     Faces_Setup
  231. }
  232.  
  233. proc Faces_Setup args {
  234.     global faces faceCache exmh
  235.  
  236.     # should call this when one of these changes:
  237.     #    faces(path), faces(dir), faces(sets), env(FACEPATH)
  238.     Face_SetPath
  239.  
  240.     catch {unset faceCache}
  241.  
  242.     # Clear any faces (and delete images)
  243.     if [info exists faces(alloc)] {
  244.     Face_Delete
  245.     }
  246.  
  247.     set faces(alloc) 0        ;# last label allocated
  248.     set faces(avail) 0        ;# next label available for use
  249.  
  250.     catch {destroy $faces(rowparent).faceRow}
  251.     if [winfo exists $faces(parent).default] {
  252.         catch [concat destroy [winfo children $faces(parent)]]
  253.  
  254.     # shrink the hole (why do I have to do this?)
  255.     $faces(parent) config -width 1
  256.     update idletasks
  257.     $faces(parent) config -width 0
  258.     }
  259.  
  260.     if {$faces(rowEnabled) && $exmh(slowDispShowFaces)} {
  261.     set row [Widget_Frame $faces(rowparent) faceRow Face {top fill}]
  262.     pack $row -before $faces(parent) -side bottom
  263.  
  264.     set faces(frame) $row
  265.     set faces(rowbg) [lindex [$row config -bg] 4]
  266.     } else {
  267.         set faces(frame) $faces(parent)
  268.     }
  269.  
  270.     global exmh
  271.     set faces(default) [Widget_Label $faces(frame) default {left fill} \
  272.             -bitmap @$exmh(library)/exmh.bitmap]
  273.  
  274.     # kludge to get default background of the labels
  275.     if {$faces(rowEnabled) && $exmh(slowDispShowFaces)} {
  276.     set f [FaceAlloc]
  277.     set faces(facebg) [lindex [$f config -bg] 4]
  278.     Face_Delete
  279.     }
  280. }
  281.  
  282.  
  283. proc Quote_Init {} {
  284.     global quote
  285.  
  286.     Exmh_Debug "Quote_Init"
  287.     set quote(add) [WidgetGetResources . quoteAdd]
  288.     set quote(omit) [WidgetGetResources . quoteOmit]
  289.  
  290.     Preferences_Add "Quoting" \
  291. "     The following options control how exmh writes to the quoting
  292. file, @ by default.  This file contains a version of the message
  293. replied to that sedit or other editors can use to quote.  Currently
  294. there are two basic choices for the quote file.  It can either be a
  295. symlink to the original message, or it can be a composite message
  296. built by only including some types of a MIME message after
  297. type-specific processing.
  298.  
  299.      If simple symlinking is off, exmh will read the X resources
  300. (usually in app-defaults or ~/.exmh-defaults) to determine which
  301. MIME types to process.  A mime type is processed if it matches a 
  302. string-match (glob) pattern in *quoteAdd unless it matches one
  303. in *quoteOmit.  For instance, if quoteAdd is text/* and *quoteOmit
  304. is text/richtext, all MIME types starting in text/ will be added
  305. except for text/richtext.  
  306.     You can add to the resources in *quoteAdd with resources named
  307. *uquoteAdd and *lquoteAdd, and remove resources from *quoteAdd with
  308. resources named *u-quoteAdd and *l-quoteAdd.  There are similar
  309. resources for tuning *quoteOmit.
  310.     By default, only decrypted PGP messages and text/* types are added.
  311.  
  312.      If a MIME type is to be included, and *quote_type is
  313. non-empty, the function in *quote_type is run on that MIME section.
  314. For instance, if the following resources were set:
  315.  
  316. *quoteUAdd: message/rfc822 text/* multipart/* application/pgp \
  317.     foo1/bar1 foo2/bar2 foo3/*
  318. *quoteUOmit: foo3/barnone
  319. *quote_message/rfc822:          Quote_Message
  320. *quote_multipart/signed:        Quote_MultipartSigned
  321. *quote_multipart/encrypted:     Quote_MultipartEncrypted
  322. *quote_application/pgp:            Quote_AppPgp
  323. *quote_multipart/default:    Quote_MultipartDefault
  324. *quote_foo3/default:            Quote_FooThree
  325. *quote_foo1/bar1:               Quote_FooBar
  326.  
  327. Then the MIME types that would be quoted are message/rfc822, 
  328. application/pgp, foo1/bar1, foo2/bar2, and any type starting with
  329. text, multipart, and foo3, except for foo3/barnone.
  330.  
  331. Tcl programmers who want custom treatment of certain MIME types can
  332. write their own quoting functions and specify them in the above way.
  333. In the above example, Quote_FooThree and Quote_FooBar must be added
  334. by the user.  Users unfamiliar with tcl are best off modifying
  335. *quoteUAdd and *quoteUOmit only.
  336.  
  337.      If symlinking is off, the message being replied to must appear 
  338. in the exmh display.  To quote a PGP encrypted message, it must 
  339. already be decrypted.  Otherwise, it will be omitted like any other 
  340. unquotable MIME type." {
  341.     {quote(enabled) quoteEnabled ON {Enable quoting}
  342. "If you do not enabled quoting, exmh will not create any quote file
  343. when replying." }
  344.     {quote(filename) quoteFilename @ {Quote file name}
  345. "The filename of the quote file, either with an absolute path or
  346. relative to the exmh startup directory.  The default is @, but you may
  347. want to pick another location such as Mail/@ if the exmh startup
  348. directory is world readable." }
  349.     {quote(symlink) quoteSymlink OFF {Only symlink}
  350. "In previous versions of exmh, the quote file was only a symlink to
  351. the message being replied to.  Select this if you want to override
  352. the following options and keep this behavior." }
  353.     {quote(headers) quoteHeaders ON {Include headers}
  354. "If this is off, exmh will not write the headers of the message
  355. being replied to into the quote file.  Sedit expects this to be on." }
  356.      }
  357. }
  358. proc Sound_Init {} {
  359.     global sound
  360.     # Preferences_Add will set these variables to Xresource values,
  361.     # but only if the variables are not already defined.
  362.     # These sound variables are defined at install time,
  363.     # so we need to unset them in order honor any per-user defaults.
  364.     set cmd $sound(cmd) ; unset sound(cmd)
  365.     Preferences_Add "Sound" \
  366. "Exmh can provide audio feedback.  It can ring your terminal bell, or play audio files." \
  367.     [list \
  368.     { sound(enabled) soundEnabled ON {Sound feedback}
  369. "Enable audio feedback.  Exmh will make a sound when
  370. new messages are incorporated into your folders
  371. (except during startup) and when you try to change
  372. folders without committing moves and delete operations."} \
  373.     { sound(multifile) soundMultiFile OFF {Play Multiple}
  374. "Exmh will play the sound more than once if a large 
  375. number of messages arrive.  If your play command can 
  376. handle multiple audio files in one invocation, then 
  377. set this option.  With this option on Exmh will run 
  378. the play command in the background and the sound 
  379. filename will be repeated as an argument.
  380.  
  381. For example, \"play sound sound sound\" would be run 
  382. in the background if three sounds were to be played."} \
  383.     [list sound(bell) soundBell OFF {Use terminal bell} \
  384. "Ring the terminal bell instead of playing an audio file."] \
  385.     [list sound(cmd) soundCmd $cmd {Play command} \
  386. "The command line used to play audio files.  You may want
  387. to add flags to control the volume, for example.  The
  388. name of the audio file is appended to this command line."] \
  389.     [list sound(newMsg) soundNewMsg drip.au {Sound for a new message} \
  390. "The name of an audio file to play when
  391. new messages have arrived.  Relative pathnames are
  392. searched for in the exmh script library directory.
  393. Pathnames beginning with \"~\" will be expanded."] \
  394.     [list sound(error) soundError clink.au {Sound for an error} \
  395. "The name of an audio file to play when
  396. you forget to commit pending operations.  Relative pathnames are
  397. searched for in the exmh script library directory.
  398. Pathnames beginning with \"~\" will be expanded."] \
  399. ]
  400.     if {$sound(enabled) && ([string length $sound(cmd)] == 0)} {
  401.     set sound(bell) 1
  402.     }
  403. }
  404.  
  405. proc Sedit_Init {} {
  406.     global sedit
  407.  
  408.     set sedit(init) 1
  409.     set sedit(height) 20
  410.     set sedit(allids) {}
  411.  
  412.     if ![info exists sedit(key,sendMsg)] {
  413.     set sedit(key,sendMsg) <Control-c><Control-c>
  414.     }
  415.     Preferences_Add "Simple Editor" \
  416. "Exmh comes with a simple built in editor called \"sedit\".
  417. It has about 20 keybindings for basic editing operations.
  418. You can tune these bindings with the Bind dialog that defines
  419. bindings for the Text and Entry widget classes."  {
  420.     {sedit(pref,replPrefix) replPrefix "> " {Reply insert prefix}
  421. "This string is prepended to lines included from the reply message
  422. when you use the Quote command."}
  423.     {sedit(formatChoice) seditFormatMail {CHOICE OnSend OnType Never} {Format Mail default}
  424. "Sedit can format mail at two different times:
  425. OnSend converts soft line wraps to hard line breaks when you hit the send button.
  426. OnType generates hard line breaks as you type.
  427. Never does no formatting at either time.
  428. The text/enriched formatting is done for both OnSend and OnType
  429. formatting choices.
  430. This Preference setting chooses the default behaviour, which
  431. you can change with the Format menu entry."}
  432.     {sedit(mhnDefault) seditAttemptMhn OFF {Attempt mhn default}
  433. "Sedit can send your message thru mhn in order to expand its #
  434. MIME formating directives (see the man page about mhn for details).
  435. You can control whethor or not this happens with the Attempt mhn menu
  436. item.  This Preference setting chooses the default for that item."}
  437.     {sedit(keepDefault) seditKeepOnSend OFF {Keep on send default}
  438. "Sedit can save its window after you send a message.  This is useful
  439. if you want to send variations on the same message to different addresses.
  440. This Preference setting chooses the default for this option."}
  441.     {sedit(quoteDefault) seditQuotedPrintable {CHOICE automatic always never} {Quoted-printable default}
  442. "Sedit can encode text as quoted-printable to protect 8-bit characters.
  443. Automatic means it will do this when you use the Compose key to
  444. insert an 8-bit character.  Always means it always does it.
  445. Never means it never does it.  You can also override this on
  446. a per-message basis with the Quoted-Printable menu entry."}
  447.     {sedit(lineLength)   seditLineLength 79 {Max Line Length}
  448. "This is the length at which Format Mail chops lines.
  449. It looks around for a word break when chopping."}
  450.     {sedit(autoSign) seditAutoSign OFF {Automatically sign messages.}
  451. "This will cause your .signature (or selected .signature* file) to
  452. be automatically appended to your message when you Send it."}
  453.     {sedit(sigDashes) seditSigDashes ON {Put a '-- ' before signature.}
  454. "This puts a '-- ' on a line between your mail and signature,
  455. as per ELM and also Usenet news.  This is only done for single-part mail."}
  456.     {sedit(sigPosition) seditSigPosition {CHOICE end insert} {Where to position the signature.}
  457.     "Where do you want your signature? At the _end_ or at the current insertion position?"}
  458.     {sedit(sigfileDefault) seditSignatureFile "" {Default signature file}
  459. "This is the name of the default signature file.  If set to something,
  460. then this will be used as the default signature file in the Sign menu
  461. for the built-in editor.  It is assumed to match the ~/.signature* pattern."}
  462.     {sedit(colorize) seditColorize OFF {Colorize multiparts}
  463. "For debugging, the multipart structure of a message can be highlighted
  464. by coloring different type parts with different background colors."}
  465.     {sedit(iso) seditISO ON {Specify Charset for Text}
  466. "If enabled, this option adds character set information to
  467. text content types, and promotes all messages to at least
  468. MIME content-type text/plain."}
  469.     {sedit(charset) seditCharset {CHOICE iso-8859-1 iso-8859-2 iso-8859-8 koi8-r utf-8} {8-bit character set}
  470. "If you have enabled support for ISO character sets and enter
  471. text that has the 8-th bit set, then
  472. this is the character set used for text content types"}
  473.     {sedit(defaultType) seditDefaultType {CHOICE text/plain application/octet-stream} {Default type for unknown files}
  474. "If the type of a file cannot be determined from the mime.types file
  475. and from the file -m program, use this as the default MIME type
  476. when attaching files."}
  477.     {sedit(spell) seditSpell {CHOICE spell ispell custom} {spell program}
  478. "This chooses the spell program used by the built-in editor.
  479. Use custom if you want to define the program explicitly."}
  480.     {editor(spell) spellCmd {exmh-async xterm -e ispell} {custom spell command}
  481. "NOTE: this affects the same internal variable as the
  482. Spell Command in Editor preferences.
  483.  
  484. There are two flavors of spell programs.  If your spell program just
  485. prints out the misspelled words, then just specify it directly.
  486. Examples include the standard \"spell\" program.  If you spell program
  487. is interactive, then run it from exmh-async:
  488. exmh-async xterm -e ispell
  489. (This is faked - exmh-async isn't really used.  Instead a temporary
  490. wish script is used.)"}
  491.     {sedit(autosaveInterval)   seditAutosaveInterval 60 {Seconds between auto saves}
  492. "This is the interval, in seconds, between automatic saves of 
  493. the message being edited.  Set to 0 to disable autosaving."}
  494.     {sedit(useFilter) seditUseFilter ON
  495.      {Access to Unix filter mechanism}
  496. "Adds the ability to filter selected text through an arbitrary Unix
  497. filter while composing messages.  Very handy for adding attributions,
  498. stripping whitespace, applying a rot13 filter (and so forth), all on the
  499. fly."}
  500.     }
  501.     Preferences_Resource sedit(wordbreakpat) seditWordBreakPat "\[\ \t/>\]"
  502.     # Converting from boolean to choice
  503.     switch $sedit(formatChoice) {
  504.     1 {set sedit(formatChoice) OnSend}
  505.     0 {set sedit(formatChoice) Never}
  506.     }
  507.     # Colors for multiparts
  508.     Preferences_Resource sedit(c_enrichedBg)     c_enrichedBg pink
  509.     Preferences_Resource sedit(c_textBg)     c_textBg snow
  510.     Preferences_Resource sedit(c_audioBg)     c_audioBg gold
  511.     Preferences_Resource sedit(c_imageBg)     c_imageBg powderblue
  512.     Preferences_Resource sedit(c_messageBg)     c_messageBg seashell
  513.     Preferences_Resource sedit(c_applicationBg) c_applicationBg honeydew
  514.     Preferences_Resource sedit(c_videoBg)    c_videoBg lavenderblush
  515.  
  516.     Preferences_Resource sedit(c_enrichedFg)     c_enrichedFg black
  517.     Preferences_Resource sedit(c_textFg)     c_textFg black
  518.     Preferences_Resource sedit(c_audioFg)     c_audioFg black
  519.     Preferences_Resource sedit(c_imageFg)     c_imageFg black
  520.     Preferences_Resource sedit(c_messageFg)     c_messageFg black
  521.     Preferences_Resource sedit(c_applicationFg) c_applicationFg black
  522.     Preferences_Resource sedit(c_videoFg)    c_videoFg black
  523.  
  524. }
  525.  
  526. if {[info command Sedit_CheckPoint] == ""} {
  527. proc Sedit_CheckPoint {} {
  528.     # Dummy routine overridden when/if sedit.tcl is auto-loaded
  529. }
  530. }
  531.  
  532. proc Pgp_Init {} {
  533.     global pgp env miscRE
  534.  
  535.     # Load a minimal amount of data
  536.     # Otherwise it cannot check for pgp
  537.     Pgp_Base_Init
  538.  
  539.     # Set up exmh for a pgp version
  540.     # if there is an appropriate keyring
  541.     foreach v $pgp(supportedversions) {
  542.         if { [file exists [set pgp($v,pubring)]] && 
  543.              [file isdirectory [set pgp($v,path)]] &&
  544.          [file exists $pgp($v,path)/$pgp($v,executable,version)]} {
  545.  
  546.          ExmhLog "Check for PGP version $v"
  547.  
  548.          catch {exec $pgp($v,path)/$pgp($v,executable,version) $pgp($v,executable,versionflags)} voutput
  549.  
  550.          ExmhLog "exec returned $voutput"
  551.  
  552.          if {[regexp $pgp($v,executable,versionregexp) $voutput]} {
  553.  
  554.              set pgp($v,enabled) 1
  555.              set pgp(enabled) 1
  556.              lappend setup $v
  557.  
  558.              ExmhLog "enable pgp version $v"
  559.  
  560.          }
  561.     }
  562.     }
  563.     if { ![info exists setup] } {
  564.         return
  565.     }
  566.  
  567.     # Now that we know, that there is a pgp variant
  568.     # installed on the system, we load all the stuff
  569.     # every pgp version needs for basic functionality
  570.     Pgp_Shared_Init    
  571.  
  572. # Global PGP preferences
  573.     Preferences_Add "General PGP Interface" \
  574. "Pretty Good Privacy (PGP) lets you sign and encrypt messages using 
  575. public keys.
  576. There is considerable documentation that comes with PGP itself.
  577. This set of preferences controls the general behavior of all the
  578. PGP modules." {
  579.     {pgp(seditpgp) pgpSeditPgp OFF {Sedit PGP passphrase}
  580. "Turning this on provides you with a PGP passphrase field in the sedit
  581. window so that you will not be prompted with the passphrase prompt." }
  582.     {pgp(seditpgpextras) pgpSeditPgpExtras OFF {Sedit PGP extras info}
  583. "Turning this on gives extra information about what key and PGP
  584. version are currently selected.  Users with multiple PGP keys or PGP
  585. versions may find it helpful.  Changing this value will require that 
  586. you exit and re-enter exmh if you've already composed email." }
  587.     {pgp(sign) pgpSign {CHOICE none standard clearsign encryptsign} {Signature options}
  588. "There are multiple ways to sign a message.
  589.     None: Do not sign outgoing messages.
  590.     Standard: Sign outgoing messages.
  591.     Clearsign: Sign messages so that they can be read by non-PGP mail readers.
  592.     Encryptsign: Sign and encrypt in a single operation.
  593. This can be changed on the fly from the sedit window." }
  594.     {pgp(encrypt) pgpEncrypt OFF {Encrypt-only outgoing messages}
  595. "If this is turned on, outgoing messages will be encrypted but not signed." }
  596.     {pgp(format) pgpFormat {CHOICE pm plain app} {Format to encode PGP}
  597. "There are multiple standards for PGP encoding.
  598.     Pm:     Use the multipart/pgp standard (This is the preferred standard)
  599.     Plain:  No MIME headers at all
  600.     App:    Use the now deprecated application/pgp standard.
  601. This can be changed on the fly from the sedit window." }
  602.     }
  603.  
  604.     Preferences_Add "General PGP Interface" "" [list \
  605.     [list pgp(version) pgpVersion [concat CHOICE $setup] \
  606.     {Version of PGP for new messages} \
  607. "There are multiple versions of the PGP program.
  608.     PGP:    Pretty Good Privacy, Version 2
  609.     PGP5:   Pretty Good Privacy, Version 5
  610.     PGP6:   Pretty Good Privacy, Version 6
  611.     GPG:    GNU Privacy Guard
  612. This can be changed on the fly from the sedit window." ] \
  613.     [list pgp(noversion) pgpNoVersion [concat CHOICE $setup] \
  614.     {Version of PGP for handling unknown PGP messages} \
  615. "Very seldom you happen to get PGP messages which don't carry
  616. the PGP header line
  617. Version: xxx
  618. In such a case Exmh falls back to a default PGP version.
  619. Here you can select, which version to use in these cases.
  620.     PGP:    Pretty Good Privacy, Version 2
  621.     PGP5:   Pretty Good Privacy, Version 5
  622.     PGP6:   Pretty Good Privacy, Version 6
  623.     GPG:    GNU Privacy Guard." ] ]
  624.  
  625.     Preferences_Add "General PGP Interface" "" {
  626.     {pgp(keeppass) pgpKeepPass ON {Keep PGP passphrase}
  627. "Exmh tries to remember your passphrase between PGP
  628. invocations. But the passphrase is then kept in a global
  629. variable, which is not safe, because of \"send\"'s power.
  630. If you turn this feature off, exmh will use xterm to run
  631. pgp so that it doesn't have to deal with the passphrase at all." }
  632.     {pgp(echopass) pgpEchoPass  ON {Echo '*' when typing pass}
  633. "If you have pgpKeepPass on, Exmh will prompt for your passphrase.
  634. A * will be echoed for every character typed depending on this option." }
  635.     {pgp(grabfocus) pgpGrabFocus  ON {Passphrase dialog grabs input focus}
  636. "When exmh prompts for the PGP passphrase it will globally grab input 
  637. focus if this is on.  Some users like it because they don't need to
  638. select the popup dialog or because it lessens the risk they will type
  639. their passphrase in the wrong window.  It annoys or does not work for
  640. other people." }
  641.     {pgp(passtimeout) pgpPassTimeout 60 {Minutes to cache PGP passphrase}
  642. "Exmh will clear its memory of PGP passphrases after
  643. this time period, in minutes, has elapsed." }
  644.     }
  645.  
  646.     # Make sure we don't inherit a bad pgp(version) from a previous setup
  647.     if ![set pgp($pgp(version),enabled)] {
  648.     set pgp(version) [lindex $setup 0]
  649.     Preferences_Tweak pgp(version)
  650.     }
  651.  
  652.     # Fix up change in pgp(sign) value
  653.     switch $pgp(sign) {
  654.     detached -
  655.     1 {set pgp(sign) standard}
  656.     0 {set pgp(sign) none}
  657.     }
  658.  
  659.     # And now load the version specific stuff
  660.     foreach v $setup {
  661.         # Load version specific support
  662.         Pgp_${v}_Init
  663.         # Add version specific Preferences
  664.         Pgp_Preferences $v
  665.     }
  666.  
  667.     # Other initialization
  668.     Pgp_Match_Init
  669.     Pgp_Exec_Init
  670.  
  671. }
  672.  
  673. # Glimpse_Init
  674. #
  675. #  glimpse options used in extrasInit.tcl    : version   : variable
  676. #
  677. #  -# : approximate matching (max error in match):since 1.0:glimpse(maxErrors)
  678. #  -w : whole word                : since 1.0:glimpse(wholeWord)
  679. #  -i : case insensitive            : since 1.0:glimpse(caseSensitive)
  680. #  -F : file pattern                : since 1.0:glimpse(singleIndex)
  681. #  -L {limit} : limit on the matches        : since 2.0:glimpse(maxHits)
  682. #               (max hits (per folder))
  683. #  -L {limit}:0:{flimit} : limit per file    : since 3.0:glimpse(maxHitsMsg)
  684. #               (max hits per message)
  685.  
  686. proc Glimpse_Init {} {
  687.     global glimpse
  688.  
  689.     if {[string length $glimpse(path)] == 0} {
  690.         global exwin
  691.         catch {destroy $exwin(fopButtons).glimpse}
  692.         catch {$exwin(fopButtons).search.m entryconfigure Glimpse* -state disabled}
  693.         return
  694.     }
  695.     if [info exists glimpse(init)] { return }
  696.  
  697.     if {[catch {exec $glimpse(path)/glimpse -V} voutput] >= 2} {
  698.         ExmhLog "$voutput"
  699.         return
  700.     }
  701.     if {! [regexp {[0-9]\.[0-9]*} $voutput glimpse(version)] } {
  702.         ExmhLog "glimpse version info error : $voutput"
  703.         return
  704.     }
  705.     set glimpse(init) 1
  706.  
  707.     Preferences_Add "Glimpse" \
  708. "Glimpse (which stands for GLobal IMPlicit SEarch) is an indexing and query
  709. system that allows you to search through all your files very quickly.  You
  710. could set here your default values. The 'Glimpse Window' allows you to re-
  711. define them for a search in the menu 'opts'." {
  712.         {glimpse(caseSensitive) glimpseCaseSensitive ON {Case sensitive search}
  713. "Determines if the search is case sensitive or not.  This could be
  714. changed on the fly in the 'Glimpse Window' in the menu 'opts'"}
  715.         {glimpse(wholeWord) glimpseWholeWord ON {Match only whole words}
  716. "If set to on your search string is assumed to be a complete word.  This
  717. could be changed on the fly in the 'Glimpse Window' in the menu 'opts'"}
  718.         {glimpse(searchRange) glimpseSearchRange {CHOICE all subtree current all-in-one}
  719.  {Default search range is}
  720. "The default search range of glimpse:
  721.     all:     search in all your mails
  722.     subtree: search in the current and all subfolders.
  723.     current: search is restricted to the current folder
  724. This can be changed on the fly in the 'Glimpse Window' in the menu 'opts'"} }
  725.  
  726. if {$glimpse(version) >= 2.0} {
  727.     Preferences_Add "Glimpse" "" {
  728.         {glimpse(maxHits) glimpseMaxHits {CHOICE 50 100 200 500 1000 2000 10000}
  729. {Maximum number of matches (*per folder*)}
  730. "Outputs only the first x matching records.
  731. This applies on a per-folder basis, not per file.
  732. If you have a single large glimpse index, it applies
  733. to the whole search.
  734.  
  735. The maximum # of matches can be changed on the fly in the 'Glimpse Window'
  736. in the menu 'opts'"} } }
  737.  
  738. if {$glimpse(version) >= 3.0} {
  739.     Preferences_Add "Glimpse" "" {
  740.     {glimpse(maxHitsMsg) glimpseMaxHitsMsg {CHOICE unlimited 1 5 10 100}
  741. {Maximum number of matches *per message*}
  742. "Outputs only the first x matching records.
  743. This applies on a per-message basis.
  744.  
  745. The maximum # of matches can be changed on the fly in the 'Glimpse Window'
  746. in the menu 'opts'"} } }
  747.  
  748. Preferences_Add "Glimpse" "" {
  749.     {glimpse(maxErrors) glimpseMaxErrors {CHOICE none 1 2 3 4 5 6 7 8}
  750. {Maximum allowed errors}
  751. "Specifying the maximum number of errors permitted in finding the approximate
  752. matches (the default is none).  Generally, each insertion, deletion, or
  753. substitution counts as one error.
  754.  
  755. If not set to 'none' your search string is assumed to be a complete word.
  756.  
  757. The number of errors allow can be changed on the fly in the 'Glimpse Window'
  758. in the menu 'opts'"}
  759.     {glimpse(singleIndex) glimpseSingleIndex OFF {Use single index file}
  760. "If set to on, uses a single glimpse index file stored in the .glimpse
  761. directory in your MH home directory"}
  762.     }
  763. }
  764.  
  765. proc Signature_Init {} {
  766.     Preferences_Add "Intelligent Signatures" \
  767. "Outgoing messages may be signed differently depending upon whether
  768. they are being sent solely within the local domain, or outside of it." {
  769.     { intelligentSign(state) intelligentSign OFF {Intelligent sign default}
  770. "If intelligent signing is on by default, the appropriate signature
  771. will be chosen just before mail is sent out.  This may be changed on
  772. a per-message basis using the \"Sign...\" menu in a sedit window."}
  773.     { intelligentSign(showhdrs) intelligentSigShowHdrs OFF {Show headers in sedit}
  774. "Various arguments are passed to executable .signatures giving
  775. information about the MH command used to compose this message, current
  776. folder at the start of composition, and full pathname of the draft
  777. message (irrespective of whether intelligent signatures are enabled or
  778. not).  This information is saved in the headers of the draft.  Enabling
  779. this Preference setting causes those header lines to be shown initially
  780. in the sedit window."}
  781.     { intelligentSign(internal) intelligentSigInt "~/.signature"
  782. {Internal signature} "This is the name of the default file to use for signing
  783. messages being sent solely within the local domain."}
  784.     { intelligentSign(external) intelligentSigExt "~/.signature"
  785. {External signature} "This is the name of the default file to use for signing
  786. messages being sent outside the local domain."}
  787.     { intelligentSign(domain) intelligentSigDomain {} {Local domain}
  788. "This is a (space-separated) list of domains to be considered local;
  789. mail sent to addresses only in these domains will always be signed
  790. with the local signature."}
  791.     }
  792. }
  793.  
  794. proc UnseenWin_Init {} {
  795.   global unseenwin
  796.  
  797.   Preferences_Add "Unseen Window" \
  798. "The unseen window, if enabled, shows a list of folders with unseen
  799. messages (together with the number of unseen messages).  Options exist
  800. to control its size (which in turn controls its behaviour as entries
  801. are inserted or removed and also to control the action that will occur
  802. if you click in the window." \
  803.   {
  804.     { unseenwin(on) unseenWinOn OFF {Enable Unseen Window}
  805. "Enables the unseen window."
  806.     }
  807.  
  808.     { unseenwin(icon) unseenWinIcon OFF {Icon Window}
  809. "Tries to tell the window manager to use the unseen window as
  810. exmh's icon.
  811. Note: doesn't work with all window managers."
  812.     }
  813.  
  814.     { unseenwin(minlines) unseenWinMinLines 3 {Minimum Entry Lines}
  815. "The minimum number of entries that the unseen window will show.
  816. This controls the minimum height that the unseen window will adopt."
  817.     }
  818.  
  819.     { unseenwin(maxlines) unseenWinMaxLines 10 {Maximum Entry Lines}
  820. "The maximum number of entries that the unseen window will show.
  821.  
  822. If set and the size of the entries exceeds the maximum,
  823. scanning (using button 2) is enabled in the window.
  824.  
  825. If left blank (or set to a value less than the minimum),
  826. the icon window will always grow to accomodate the current
  827. number of entries."
  828.     }
  829.  
  830.     { unseenwin(minwidth) unseenWinMinNameWidth 11 {Minimum Name Width}
  831. "The minimum number of characters that will be used
  832. for the folder name.  This in turn controls the minimum
  833. width that the unseen window will adopt."
  834.     }
  835.  
  836.     { unseenwin(maxwidth) unseenWinMaxNameWidth 20 {Maximum Name Width}
  837. "The maximum number of characters that will be used
  838. for the folder name.
  839.  
  840. If set and a folders name exceeds the width, it is cropped
  841. to display just the last characters preceeded by ellipsis such
  842. that it doesn't exceed the given width.
  843.  
  844. If left blank (or set to a value less than the minimum width),
  845. the unseen window will always grow to accomodate the maximum
  846. folder width."
  847.     }
  848.  
  849.     { unseenwin(font) unseenWinFont 6x10 {Font}
  850. "The font to use in the unseen window."
  851.     }
  852.  
  853.     { unseenwin(hidewhenempty) unseenWinHideWhenEmpty OFF {Hide When Empty}
  854. "The unseen window will only be displayed when there are unseen
  855. messages."
  856.     }
  857.  
  858.     { unseenwin(emptymsg) unseenWinEmptyMsg {NO UNREAD MAIL} {Empty Message}
  859. "The message to display in the unseen window when there are
  860. no unread messages.
  861.  
  862. Note; if \"Hide When Empty\" is on, this option has no use."
  863.     }
  864.  
  865.     { unseenwin(b1mode) unseenWinButton1
  866.       {CHOICE None Raise Warp {Warp & Show}}
  867.       {Button 1 Mode}
  868. "The behaviour when you click on the unseen window depends
  869. on this setting.
  870.  
  871. None:        Nothing
  872. Raise:       Bring the main window to the front
  873.              (deiconifying if necessary)
  874. Warp:        Raise then change to the folder clicked on
  875. Warp & Show: Warp then select the first unseen message"
  876.     }
  877.  
  878.     { unseenwin(b2mode) unseenWinButton2
  879.       {CHOICE Nothing Inc}
  880.       {Button 2 Mode}
  881. "The behaviour when you press mouse button 2 depends on
  882. this setting.
  883.  
  884. Nothing:     Does nothing
  885. Inc:         Just like clicking the Inc button"
  886.     }
  887.  
  888.     { unseenwin(mb1mode) unseenWinModifiedButton1
  889.       {CHOICE None Raise Warp {Warp & Show}}
  890.       {Modified Button 1 Mode}
  891. "The behaviour when you shift-click, control-click or
  892. shift-contol-click on the unseen window depends
  893. on this setting.
  894.  
  895. None:        Nothing
  896. Raise:       Bring the main window to the front
  897.              (deiconifying if necessary)
  898. Warp:        Raise then change to the folder clicked on
  899. Warp & Show: Warp then select the first unseen message"
  900.     }
  901.  
  902.     { unseenwin(b3mode) unseenWinButton3
  903.       {CHOICE Nothing Compose}
  904.       {Button 3 Mode}
  905. "The behaviour when you press mouse button 3 depends on
  906. this setting.
  907.  
  908. Nothing:     Does nothing
  909. Compose:     Starts a mail composition"
  910.     }
  911.   }
  912.  
  913.   set unseenwin(digits) 1
  914.   trace variable unseenwin(on)            w UnseenWinToggle
  915.   trace variable unseenwin(icon)          w UnseenWinToggleIcon
  916.   trace variable unseenwin(font)          w UnseenWinChangeFont
  917.   trace variable unseenwin(emptymsg)      w UnseenWinEmptyMsg
  918.   trace variable unseenwin(hidewhenempty) w UnseenWinEmptyMsg
  919.   foreach v {minlines maxlines minwidth maxwidth} {
  920.     trace variable unseenwin($v) w UnseenWinChangeMinMax
  921.   }
  922.   foreach v {b1mode mb1mode} {
  923.     trace variable unseenwin($v) w UnseenWinToggleClick
  924.   }
  925.   if {$unseenwin(on)} {
  926.       UnseenWinToggle
  927.   }
  928. }
  929.